<template>
  <span>
    <a @click="handleClick">{{ name }}</a>
  </span>
</template>

<script lang="ts" setup>
import pubsub from "pubsub-js"
import { ref, onMounted, toRaw } from 'vue';
const props = defineProps({
  id: { type: String },
  name: { type: String },
  eventName: { type: String, default: "quickOpen"},
  // 用于表单有多个列点击打开抽屉时候的判断逻辑
  type: { type: String, default: "default"},
  data: { type: Object, default: () => ({}) }
})

onMounted(() => {

})

const handleClick = () => pubsub.publish(props.eventName, { id: props.id, ...toRaw(props.data) })
</script>